<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<%@ include file="/common/meta.jsp"%>
		<link rel="stylesheet" type="text/css" href="${ctx}/resource/css/crud.css" />
		<link rel="stylesheet" type="text/css" href="${ctx}/resource/js/dialog.css" />
		<script src="${ctx}/resource/js/jquery-1.4.2.min.js" type="text/javascript"></script>
		<script src="${ctx}/resource/js/CRUDSupport.js" type="text/javascript"></script>
		<script src="${ctx}/resource/js/dialog.js" type="text/javascript"></script>
		<script>
	
		function showURLDialog(url) {
			new Dialog( {
				title:'fdfd',
				type : 'url',
				value : url,
				modal : false
			}).show();
		}
</script>
	</head>
	<body>
		<form id="crudForm" action="user.action" method="get">
			<input type="hidden" name="page.pageNo" id="pageNo" value="${page.pageNo}" />
			<input type="hidden" name="page.orderBy" id="orderBy" value="${page.orderBy}" />
			<input type="hidden" name="page.order" id="order" value="${page.order}" />

			<table>
				<tr>
					<td><div class="title">用户管理</div></td>
					<td><s:actionmessage theme="custom" cssClass="message" /></td>
				</tr>
			</table>
			
			<div class="operate">
				<security:authorize ifAnyGranted="修改用户">		
					<a href="${ctx}/administrate/user!input.action"><img src="${ctx}/resource/images/add.gif" /> </a>
				</security:authorize>
				<p><a href="#" onclick="showURLDialog('${ctx}/administrate/user!input.action')" >Open Dialog</a></p>
			</div>
			<div class="search"">
				关键字：
				<input type="text" name="filter_LIKES_username_OR_truename_OR_email" value="${param['filter_LIKES_username_OR_truename_OR_email']}" style="width: 150px" />
				<input type="button" value="搜索" onclick="search();" />
			</div>
			<table width="100%" class="dataTable">
				<tr class="dataTableHead">
					<td width='40' align="center">序号</td>
					<td width='30' align="center">
						<input type='checkbox' id="selectAllCheckbox" onclick="selectAll(this)" />
					</td>
					<td>用户名</td>
					<td>真实姓名</td>
					<td>邮箱</td>
					<td width="400">角色</td>
					<td colspan="2" align="center" width='60'>操作</td>
				</tr>

				<s:iterator value="page.result" status="status">
					<tr onclick="clickTr(this, event);">
						<td align="center"><b>${page.first + status.index}</b></td>
						<td align="center"><input type='checkbox' name="${id}" id="checkbox${status.index+1}" /></td>
						<td>${username}</td>
						<td>${truename}</td>
						<td>${email}</td>
						<td>${roleNames}</td>
						
						<td>		
							<security:authorize ifAnyGranted="修改用户">					
							<a onclick="showURLDialog('${ctx }/administrate/user!input.action?id=${id}')" href="#"><img src="${ctx}/resource/images/edit.gif" title="编辑" /> </a>
							</security:authorize>							
						</td>
						<td>
							<security:authorize ifAnyGranted="修改用户">				
							<a href="#"> <img src="${ctx}/resource/images/delete.gif" title="删除" /> </a>
							</security:authorize>
						</td>
				
					</tr>
				</s:iterator>

				<tr>
					<td align="right" colspan="6">
						共${page.totalCount}条记录，每页${page.pageSize}条，当前第${page.pageNo}/${page.totalPages}页
						<a href="javascript:jumpPage(1)">首页</a>
						<s:if test="page.hasPre">
							<a href="javascript:jumpPage(${page.prePage})">上一页</a>
						</s:if>
						<s:if test="page.hasNext">
							<a href="javascript:jumpPage(${page.nextPage})">下一页</a>
						</s:if>
						<a href="javascript:jumpPage(${page.totalPages})">末页</a>
					</td>
				</tr>

			</table>
		</form>

	</body>
</html>